<%@ page import="com.zhiyou100.www.bbs.dao.TableTitleDao" %>
<%@ page import="com.zhiyou100.www.bbs.entityclass.TableTitle" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.zhiyou100.www.bbs.dao.TableUserDao" %>
<%@ page import="com.zhiyou100.www.bbs.entityclass.TableUser" %><%--
  Created by IntelliJ IDEA.
  User: yang
  Date: 2020/6/7
  Time: 7:57 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <link rel="stylesheet" href="/bbs/css/index.css">
    <title>搜索的内容</title>
</head>
<body>
    <%
//        String topic = request.getParameter("topic");
        // 获取 搜索的内容
//        if (topic==null){
//            return;
//        }
        TableTitleDao tableTitleDao = new TableTitleDao();
        ArrayList<TableTitle> all = tableTitleDao.topicSearch("们");
        for (TableTitle tableTitle : all) {
            String tableHead = tableTitle.getTableHead();
            // 获取标题

            TableUserDao tableUserDao = new TableUserDao();
            TableUser one = tableUserDao.getOne(tableTitle.getUserId());
            // 根据用户 id 获取用户的信息
            String userName = one.getUserName();
            // 获取用户名

            String tableCreateTime = tableTitle.getTableCreateTime();
            // 获取时间

            Integer tableScore = tableTitle.getTableScore();
            // 获取关注度

            String tableContent = tableTitle.getTableContent();
            // 获取内容

            String message="<table>\n" +
                    "    <tr>\n" +
                    "        <td>"+tableHead+"</td>\n" +
                    "        <td>"+userName+"</td>\n" +
                    "        <td>"+tableCreateTime+"</td>\n" +
                    "        <td>"+tableScore+" </td>\n" +
                    "    </tr>\n" +
                    "    <tr>\n" +
                    "        <td>内容</td>\n" +
                    "        <td colspan=\"3\">"+tableContent+"</td>\n" +
                    "    </tr>\n" +
                    "</table>"+"<br>";
            out.print(message);
        }

    %>
</body>
</html>
